package medium

import (
	"sort"
)

/*
时间复杂度:O(NlogN)
空间复杂度:O(logN)
*/

func minPairSum(nums []int) int {
	sort.Ints(nums)
	i, j := 0, len(nums)-1
	result := 0
	for i < j {
		if result < nums[i]+nums[j] {
			result = nums[i] + nums[j]
		}
		i++
		j--
	}
	return result
}
